package engine.tip
{
	import engine.flag.ResourcesPath;
	
	import flash.display.MovieClip;
	import flash.text.TextField;
	
	import newx.com.config.StaticIni;
	import newx.com.control.NxClip;
	import newx.com.control.group.NxViewGroup;

	/**
	 *	跨服战tips显示容器 
	 * @author yanghr
	 * 
	 */	
	public class StrideTipsPanelUI extends TipsPanelUI
	{
		private var embattleTxt:TextField;
		
		private var petTxt:TextField;
		
		private var valueTxt:TextField;
		
		private var fightCountTxt:TextField;
		
		private var comeFromTxt:TextField;
		
		private var nullTxt:TextField;
		
		private const BG_SKIN:String="CustomControl_0222";
		public function StrideTipsPanelUI()
		{
			super();
		}
		override protected function init():void
		{
			initbg();
			valueTxt=bg.content["txt_0"];
			fightCountTxt=bg.content["txt_1"];
			comeFromTxt=bg.content["txt_2"];
			embattleTxt=bg.content["txt_3"];
			petTxt=bg.content["txt_4"];
			nullTxt=bg.content["txt_5"];
			nullTxt.htmlText=StaticIni.getSwfLangStr("Common_Null")
			embattleTxt.htmlText=StaticIni.getSwfLangStr("StrideTips_2");
		}
		override protected function initbg():void
		{
			bg	=	new NxClip();
			addChild(bg);
			bg.source=	BG_SKIN;
		}
		private function getPartnerMc(index:int):MovieClip
		{
			return bg.content["mc_"+index];
		}
		/**
		 *设置伙伴头像 
		 * @param index
		 * @param configID
		 * 
		 */		
		public function addPartnerPic(index:int,configID:int):void
		{
			var mc:MovieClip=getPartnerMc(index);
//			mc["pic"].source=ResourcesPath.getMiniHeadPic(configID);
			var nx:NxClip	=	mc["pic"];
			if(!nx)
			{
				nx=mc["pic"]=new NxClip;
				mc.addChild(nx);
			}
			if(configID)
			{
				nx.source=ResourcesPath.getMiniHeadPic(configID);
				showAllBox(index);
			}
			else
			{
				nx.source=""
//				nx.clear();
				hidAllBox(index);
//				if(index==1)
//				{
//					hidAllBox();
//				}
//				else
//				{
//					showAllBox();
//				}
			}
		}
		private function showAllBox(index:int):void
		{
			var mc:MovieClip=getPartnerMc(index);
			mc.visible=true;

			if(index==1)	
				nullTxt.visible=false;
		}
		private function hidAllBox(index:int):void
		{
			var mc:MovieClip=getPartnerMc(index);
			mc.visible=false;
			if(index==1)
				nullTxt.visible=true;
			
		}
		public function addPet(name:String,level:String):void
		{
			petTxt.htmlText=StaticIni.getSwfLangStrVar("StrideTips_3",[name,level])//getColorHtml(name+level,"ffffff");
		}
		/**
		 *身价 
		 * @param str
		 * 
		 */		
		public function set valuetxt(str:String):void
		{
			valueTxt.htmlText=str;
		}
		/**
		 *战斗力 
		 * @param str
		 * 
		 */		
		public function set fightCount(str:String):void
		{
			fightCountTxt.htmlText=str;
		}
		/**
		 *来自 
		 * @param str
		 * 
		 */		
		public function set comefrom(str:String):void
		{
			comeFromTxt.htmlText=str;
		}
		override public function clear():void
		{
			fightCount="";
			comefrom="";
			addPet("","");
			valuetxt="";
			addPartnerPic(1,0)
			addPartnerPic(2,0)
			addPartnerPic(3,0)
			addPartnerPic(4,0)
		}
		
		override public function addText(str:String):TipsPanelUI
		{
			var strr:String=str+"</br>"+addLinePic();
//			return super.addText(strr)
			return this;
		}
		override public function resize(noPic:Boolean):void
		{
			return ;
		}
		
		
	}
}